package com.ardf.entity;

import com.ardf.common.LocalTimeToStringSerializer;
import com.ardf.common.StringToLocalTimeDeserializer;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalTime;

/**
 * <p>
 * 成绩信息表
 * </p>
 *
 * @author ShiYunHao
 * @since 2025-01-06
 */
@Getter
@Setter
public class Grade implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 成绩id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 选手id
     */
    private Long athleteId;

    /**
     * 接力id
     */
    private Long teamId;

    /**
     * 项目id
     */
    private Long projectId;

    /**
     * 选手路线
     */
    private String route;

    /**
     * 用时
     */
    @TableField("`time`")
    @JsonDeserialize(using = StringToLocalTimeDeserializer.class)
    @JsonSerialize(using = LocalTimeToStringSerializer.class)
    private LocalTime time;

    /**
     * 成绩状态
     *
     * <p>
     * 0:无效<br>
     * 1:有效
     * </p>
     */
    private Byte status;

    /**
     * 小票图片证据
     */
    private String picture;

    /**
     * 备注
     */
    private String description;

    @Override
    public String toString() {
        return "Grade{" +
                "id=" + id +
                ", athleteId=" + athleteId +
                ", teamId=" + teamId +
                ", projectId=" + projectId +
                ", route='" + route + '\'' +
                ", time=" + time +
                ", status=" + status +
                ", picture='" + picture + '\'' +
                ", description='" + description + '\'' +
                '}';
    }
}
